#!/bin/bash

# 关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service

# 禁用swap交换分区
swapoff -a
sysctl -w vm.swappiness=0
sed -ri '/^[^#]*swap/s@^@#@' /etc/fstab

# 禁用SELinux
setenforce 0
sed -i 's/^SELINUX=enforcing\$/SELINUX=permissive/' /etc/selinux/config

# 同步时间
yum install -y ntp ntpdate
timedatectl set-timezone Asia/Shanghai
ntpdate cn.pool.ntp.org
hwclock --systohc
cat << EOF >> /etc/ntp.conf
server cn.pool.ntp.org
EOF
systemctl enable --now ntpd

# 安装docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl enable --now docker
